﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using System.IO;
using System.Threading;

namespace DungDungShit
{
    class MainMenuScreen : MenuScreen
    {
        public MainMenuScreen()
            : base("")
        {
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry exitGameMenuEntry = new MenuEntry("Exit");

            playGameMenuEntry.Selected += playGameMenuEntry_Selected;
            exitGameMenuEntry.Selected += OnCancel;
            menuEntries.Add(playGameMenuEntry);
            menuEntries.Add(exitGameMenuEntry);
        }
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin();
            ScreenManager.SpriteBatch.Draw(ScreenManager.TitleTexture,
                    new Vector2(150, 100),
                    new Rectangle(0, 0, 327, 276),
                    Color.White, 0, new Vector2(0, 0),
                    1f, SpriteEffects.None, 0.1f);
            ScreenManager.SpriteBatch.End();
            base.Draw(gameTime);
        }

        protected void playGameMenuEntry_Selected(object sender, EventArgs e)
        {
            //ScreenManager.AddScreen(new GameScreen(0));
            LoadingScreen.Load(ScreenManager, false, new GameScreen(0));
        }
        protected void creditMenuEntry_Selected(object sender, EventArgs e)
        {
        }
        protected void confirmExitMessageBox_Accepted(object sender, EventArgs e)
        {
            ScreenManager.Game.Exit();
        }

        protected override void OnCancel()
        {
            const string message = "Are you sure you want to exit the game?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += confirmExitMessageBox_Accepted;

            ScreenManager.AddScreen(confirmExitMessageBox);
        }
    }

}
